<script setup>
import Header from "./components/Header/header.vue"
import {useRouter,useRoute} from"vue-router"
import {onMounted} from "vue";
import {getUserMessage} from "@/api/request.js";
import {useCounterStore} from "@/stores/counter.js"

let store = useCounterStore()
const router = useRouter();
const route = useRoute()

onMounted(async () => {
  if (sessionStorage.getItem("token") !== null) {
    let userMessage = await getUserMessage()
    switch (userMessage.gender) {
      case '0':
        userMessage.gender = '男'
        break;
      case '1':
        userMessage.gender = '女'
        break;
      default:
        userMessage.gender = '未知'
        break;
    }
    store.UserMessage = userMessage
  }
})

</script>

<template>
    <Header v-if="route.meta.ishead"></Header>
    <router-view></router-view>
</template>

<style>
    body{
        margin: 0;
        padding: 0;
    }
</style>
